//2009/08/30 20:41:31
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class MegaCoolNumbersEasy
{
public:
    int count(int N)
    {
        int ret = 0;
        for (int i=1; i<=N; i++)
            if (isMegaCool(i))
                ret++;
        return ret;
    }
    bool isMegaCool(int n)
    {
        if (n < 10) return true;
        stringstream s;
        s << n;
        string ss = s.str();
        int gap = ss[1] - ss[0];
        for (int i=1; i<ss.size(); i++)
            if (ss[i] - ss[i-1] != gap)
                return false;
        return true;
    }
};
